home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
text
/
dtp
/
TileNum.lha
/
Tile Number
/
Tile_number.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
2000-09-04
|
7KB
|
228 lines
/* $VER: Tile_Numbering 2.0 (09.02.00)
for Pagestream 3.x
By Lázi (lazi@freemail.hu */
OPTIONS RESULTS
/* Make sure rexx support is opened */
IF ~SHOW('L','rexxsupport.library') THEN
CALL ADDLIB('rexxsupport.library',0,-30)
file_prefs='Pagestream3:Scripts/tilenum.prefs'
file_guide='Pagestream3:Scripts/Tile_number.guide'
/* Opening prefs file and if it fails, then set presets */
if Open(prefs_file,file_prefs,'R')=0 then do
p_tile=12
p_start=1000
p_pages=5
p_lead=''
p_digit=4
p_sorrend=0
p_varb='sorszám'
end
else do
p_tile=ReadLn(prefs_file)
p_start=ReadLn(prefs_file)
p_pages=ReadLn(prefs_file)
p_lead=ReadLn(prefs_file)
p_digit=ReadLn(prefs_file)
p_sorrend=ReadLn(prefs_file)
p_varb=ReadLn(prefs_file)
Close(prefs_file)
end
ADDRESS 'PAGESTREAM'
/* Main requester */
allocarexxrequester '"Tile Numbering"' 280 210
reqhandler=result
addarexxgadget reqhandler EXIT 12 192 70 label '"Print"'
hprintgadget=result
addarexxgadget reqhandler EXIT 200 192 70 label '"Cancel"'
hcancelgadget=result
addarexxgadget reqhandler EXIT 12 5 70 label '"About"'
aboutgadget=result
addarexxgadget reqhandler EXIT 200 5 70 label '"Help"'
helpgadget=result
addarexxgadget reqhandler STRING 200 30 70 label '"_Number of pieces"' labelpos left string p_tile
reqpiece=result
addarexxgadget reqhandler EXIT 5 50 120 label '"Make vars"'
mvarsgadget=result
addarexxgadget reqhandler EXIT 155 50 120 label '"Make tiles"'
mtilesgadget=result
addarexxgadget reqhandler STRING 200 70 70 label '"_Starting number"' labelpos left string p_start
reqstartnum=result
addarexxgadget reqhandler STRING 200 90 70 label '"_Leading string"' labelpos left string p_lead
reqlead=result
addarexxgadget reqhandler STRING 200 110 70 label '"Number of page_s"' labelpos left string p_pages
reqpages=result
addarexxgadget reqhandler STRING 200 130 70 label '"Number of _digits"' labelpos left string p_digit
reqdigits=result
addarexxgadget reqhandler STRING 200 150 70 label '"_Variable base name"' labelpos left string p_varb
reqvarb=result
addarexxgadget reqhandler CHECKBOX 150 192 10 LABEL "_Check" labelpos left
reqcheck=result
allocarexxlist
rexxlist=result
'addarexxlist 'rexxlist' "continue on page"'
'addarexxlist 'rexxlist' "continue downward"'
addarexxgadget reqhandler CYCLE 45 172 200 string '"continue on page||continue downward"'
reqsorrend=result
setarexxgadget reqhandler reqsorrend list rexxlist current p_sorrend
loop:
doarexxrequester reqhandler
action=result
getarexxgadget reqhandler reqpiece STRING
piece=result
getarexxgadget reqhandler reqstartnum STRING
startnum=result
getarexxgadget reqhandler reqpages STRING
pages=result
getarexxgadget reqhandler reqdigits STRING
digits=result
getarexxgadget reqhandler reqlead STRING
betujel=result
getarexxgadget reqhandler reqsorrend current
sorrend=result
getarexxgadget reqhandler reqvarb STRING
varb=result
getarexxgadget reqhandler reqcheck checked
check=result
freearexxreqester reqhandler
/* Handle buttons */
if action=hcancelgadget then exit
if action=mvarsgadget then do
do i=1 to piece
newvariable varb||i startnum+i-1
end i
/* 'newvariable +Next «+»'
We'll use this when Find/Replace is done for a Next Record control
The script will search the text for these. If found, it will have to
replace following variable uses until the next Next control with
varname.1, etc. Then the script will have to reset multiple var groups
at once. */
/* INFORM USER THAT VARS ARE CREATED */
allocarexxrequester '"Variables created"' 364 105
hDialog=result
addarexxgadget hDialog EXIT 282 88 70 label "OK"
hDialog.ok=result
addarexxgadget hDialog TEXT 8 10 356 border none string "'The variables have been created.'"
addarexxgadget hDialog TEXT 8 22 356 border none string "'Use the Type/Insert Variable » User String'"
addarexxgadget hDialog TEXT 8 34 356 border none string "'command to insert them into your document.'"
addarexxgadget hDialog TEXT 8 46 356 border none string "'When you are done, save it and then choose'"
addarexxgadget hDialog TEXT 8 58 356 border none string "'this macro again to print it.'"
doarexxrequester hDialog
freearexxrequester hDialog
exit
signal cleanup
end
if action=helpgadget then do
ADDRESS COMMAND 'Run Amigaguide 'file_guide' pubscreen PAGESTREAM3'
signal loop
end
if action=aboutgadget then do
allocarexxrequester '"About"' 364 120
hDialog=result
addarexxgadget hDialog EXIT 282 100 70 label "OK"
hDialog.ok=result
addarexxgadget hDialog TEXT 8 10 356 border none string "'Tile Number V2.00 by Lázi (c) 2000'"
addarexxgadget hDialog TEXT 8 34 356 border none string "'Not tested on animals, but very dangerous'"
addarexxgadget hDialog TEXT 8 46 356 border none string "'for users and employees of Microsoft.'"
addarexxgadget hDialog TEXT 8 70 356 border none string "'This script is very FREEWARE!'"
addarexxgadget hDialog TEXT 8 82 356 border none string "'lazi@freemail.hu http://www.extra.hu/lazi'"
doarexxrequester hDialog
freearexxrequester hDialog
signal loop
signal loop
end
if action=mtilesgadget then do
allocarexxrequester '"Make tiles, or not?"' 364 105
hDialog=result
addarexxgadget hDialog EXIT 282 88 70 label "OK"
hDialog.ok=result
addarexxgadget hDialog TEXT 8 10 356 border none string "'Sorry, but this function is not implemeted'"
addarexxgadget hDialog TEXT 8 22 356 border none string "'yet!'"
addarexxgadget hDialog TEXT 8 46 356 border none string "'If you need this, give me some feedback.'"
addarexxgadget hDialog TEXT 8 70 356 border none string "'lazi@freemail.hu'"
doarexxrequester hDialog
freearexxrequester hDialog
signal loop
end
openbusyrequester message "working..." thermometer enabled total pages current 0
bh=result
do oldal=1 to pages
if sorrend=0 then do
/* Continue on page */
do i=1 to piece
alma=(oldal-1)*piece+i+startnum-1
num=copies('0',digits-length(alma))
setvariablevalue betujel||num||alma VARIABLE varb||i
end i
end
else do
/* Continue on downward */
do i=1 to piece
alma=startnum+(i-1)*pages+oldal-1
num=copies('0',digits-length(alma))
setvariablevalue betujel||num||alma VARIABLE varb||i
end i
end
/* If Check is on, not doing the print job, just show the page on screen */
if check=0 then printdocument page 1 output color printermarks off mirror off negative off
else do
allocarexxrequester '"Please check Page"' 170 30
hDialog=result
addarexxgadget hDialog EXIT 20 5 50 label "Next"
hDialog.next=result
addarexxgadget hDialog EXIT 90 5 50 label "Exit"
hDialog.exit=result
doarexxrequester hDialog
kapcs=result
freearexxrequester hDialog
if kapcs=hDialog.exit then signal vege
end
setbusyrequester bh current oldal
end oldal
vege:
/* Write prefs file, when PRINT button is pressed */
if Open(prefs_file,file_prefs,'W')=1 then do
WriteLn(prefs_file,piece)
WriteLn(prefs_file,startnum)
WriteLn(prefs_file,pages)
WriteLn(prefs_file,betujel)
WriteLn(prefs_file,digits)
WriteLn(prefs_file,sorrend)
WriteLn(prefs_file,varb)
Close(prefs_file)
end
closebusyrequester bh
exit